#!/usr/bin/env python3
import os
import collections as coll

ids={}
for f in os.listdir("entries/"):
	if f=="README":
		continue
	entry_id=f.split("_")[1]
	ids[int(entry_id)] = f

ids = coll.OrderedDict(sorted(ids.items()))
for eid, efile in ids.items():
	eid=str(eid)
	if open("entries/"+efile).read() == "[DELETED]\n":
		print("---------------------------------------------------")
		print(eid + " - DELETED.")
		continue
	entry_title=open("entries/"+efile).read().split('\n')[0].split("TITLE:")[1]
	entry_date=open("entries/"+efile).read().split('\n')[1].split("DATE:")[1]
	print("---------------------------------------------------")
	print("ENTRY_ID = "+eid)
	print("TITLE: "+entry_title)
	print("DATE: "+entry_date)
	try:
		open("public_html/articles/"+eid+".html")
	except FileNotFoundError:
		print("[!] This entry is not in your blog files yet.")

print("---------------------------------------------------")
print("Done.")
